<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>无标题文档</title>
</head>

<body>

<div>
	<span>钓鱼岛是中国人的！</span><span>顶：</span>
    <span style="color:blue">10000</span>
    
    <span style="cursor:pointer;color:red" onclick="ding(this)">顶一下</span><!--this 指当前的span标签-->
    
</div>
<br />
<br />

<div>
	<span>IPhone 5c</span>购买数量<span style="color:blue">50000</span><span>非常个性化</span><span style="cursor:pointer;color:red" onclick="goumai(this)">再买一台</span>
</div>


</body>
<script type="text/javascript">
function ding(obj){  //obj=>object 对象
//前提：不设置id,要求：通过节点关系(父子)
	var span = obj.parentElement.children[2];
	
	span.innerHTML ++;

}

function goumai(obj){
	
	//不换行
	obj.previousSibling.previousSibling.innerHTML ++;
	
}

</script>

</html>
